﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;

/// <summary>
/// Summary description for AdminBasePage
/// </summary>
public class AdminBasePage : System.Web.UI.Page
{
    public tblStaff LoginedStaff
    {
        get
        {
            if (Session["LoginedStaff"] != null)
                return (tblStaff)Session["LoginedStaff"];
            else
            {
                Response.Redirect("~/Admin/index.aspx");
                return new tblStaff();
            }
        }
        set
        {
            Session["LoginedStaff"] = value;
        }
    }

    public bool isLogin()
    {
        if (Session["LoginedStaff"] != null)
            return true;
        return false;
    }

    public AdminBasePage() 
    {
        
    }

    protected override void OnLoad(EventArgs e)
    {
        base.OnLoad(e);
        if (!Request.Url.PathAndQuery.Contains("/Admin/StaffLogin.aspx") && Session["LoginedStaff"] == null)
                Response.Redirect("~/Admin/StaffLogin.aspx");
       
    }
}